<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/constrant.jsp"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>接送机-搜索页</title>
		<link rel="stylesheet" href="${ctxStatic }/gov/css/govairport.css" />
		<link rel="stylesheet" href="${ctxStatic }/gov/css/gov_total.css" />
		<script src="${ctxStatic }/jquery/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="${ctxStatic }/My97DatePicker/WdatePicker.js" ></script>
	    <script type="text/javascript" src="${ctxStatic }/gov/js/gov.js" ></script>
	    <script type="text/javascript" src="${ctxStatic }/gov/js/jquery.validate.js" ></script>
<script type="text/javascript" src="${ctxStatic }/gov/js/messages_zh.js" ></script>
<script type="text/javascript" src="${ctxStatic }/gov/js/cityselect.js" ></script>
<link href="${ctxStatic }/cityselector/cityselect.css" rel='stylesheet'type='text/css' />
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=kOQ8j9rd2ATw2R54boLMFUalu3gGNGDO&s=1"></script>
<link href="${ctxStatic }/xiake/css/list.css" rel='stylesheet' type='text/css' />
<script type="text/javascript">
//百度地图API功能
function G(id) {
	return document.getElementById(id);
}
var map = new BMap.Map("l-map");
var ac = new BMap.Autocomplete(    //建立一个自动完成的对象
	{"input" : "suggestId"
	,"location" : map
});
ac.addEventListener("onhighlight", function(e) {  //鼠标放在下拉列表上的事件
var str = "";
	var _value = e.fromitem.value;
	var value = "";
	if (e.fromitem.index > -1) {
		value = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
	}    
	str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value;
	value = "";
	if (e.toitem.index > -1) {
		_value = e.toitem.value;
		value = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
	}    
	str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value;
	G("searchResultPanel").innerHTML = str;
});
var myValue;
ac.addEventListener("onconfirm", function(e) {    //鼠标点击下拉列表后的事件
var _value = e.item.value;
	myValue = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
	G("searchResultPanel").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue;
	setPlace();
	// 选中详细地址后，调用百度地图获取 云地理编码 
	var address = encodeURIComponent(myValue);
	$.getJSON(
			"https://api.map.baidu.com/cloudgc/v1?ak=kOQ8j9rd2ATw2R54boLMFUalu3gGNGDO&s=1&address="+address+"&callback=?",
			function(data){
			if(data.status == 0 && data.result.length>0 ){
				$('#departcityName').val(data.result[0].address_components.city);
				var $sitename = $('#departcityName').val();
				$.post("${ctxFront}/sms/getSiteId","sitename="+$sitename,function(d){
					if(d!=null&&d!=''){
						$("#siteid").val(d);
					}else{
						$("#siteid").val("");
					}
				});
			}
		});
});
function setPlace(){
	map.clearOverlays();    //清除地图上所有覆盖物
	function myFun(){
		var pp = local.getResults().getPoi(0).point;    //获取第一个智能搜索的结果
		map.centerAndZoom(pp, 18);
		map.addOverlay(new BMap.Marker(pp));    //添加标注
	}
	var local = new BMap.LocalSearch(map, { //智能搜索
	  onSearchComplete: myFun
	});
	local.search(myValue);
}
</script>
<script type="text/javascript">
	$(function() {
		
		if("${message}".length>0){
			alert("${message}");
		}
		// 初始化站点选择框
		$.post('${ctxFront}/info/site/siteJson', {
			spottypes : '0'
		}, function(data) {
			var allCity = data;//['北京市#001#1|beijing|bj','上海市#002#0|shanghai|sh'];
			new Vcity.CitySelector({
				input : 'departcityName',
				cityData : allCity
			});
			new Vcity.CitySelector({
				input : 'destcityName',
				cityData : allCity
			});
		});
		
		//showCityInfo();
		$('.tstyle').click(function(){
			$("#tsy").val($(this).attr("value"));
			$("#pageNo").val(1);
			$("#pageSize").val(5);
			$('#airportRentForm').submit();
		});
		var keyVal2 = "${sessionScope.mes}";
		if(keyVal2.length!=0){  
			alert(keyVal2);
			/* window.location.href = '${ctxFront }/indexAirRent'; */
		}
		// 机场
		$.post('${ctxFront}/info/site/siteJson',{spottypes:'9'}, function(data) {
			new Vcity.CitySelector({input:'departcity_sitename3',cityData:data});
		});
		// 送达城市
		$.post('${ctxFront}/info/site/siteJson',{spottypes:'0'}, function(data) {
			new Vcity.CitySelector({input:'destcity_sitename3',cityData:data});
		});
		$('.airportRentTab').click(function(){
			$('#airportRentType').val($(this).attr('data-value'));
			changeShowSpan($(this).attr('data-value'));
		});
		
		$('.pick-air').click(function(){
			$("#airportRentType").val("接机");
		});
		$('.send-air').click(function(){
			$("#airportRentType").val("送机");
		});
	})
function page(n,s){
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#airportRentForm").submit();
		return false;
	}
	function changeShowSpan(val){
		if(val=='接机') {
			var span = $('.airportDestcitySpan');
			$(span[0]).text('出发机场：');
			$(span[1]).text('抵达城市：');
		} 
		if(val=='送机') {
			var span = $('.airportDestcitySpan');
			$(span[0]).text('抵达机场：');
			$(span[1]).text('出发城市：');
		}
}
	function showCityInfo() {
		var myCity = new BMap.LocalCity();
		myCity.get(myFun);
		//定位ip
		var cityinfo = '';
		var map = new BMap.Map("allmap");
		function myFun(result) {
			var cityName = result.name;
			cityinfo = cityName;
			$("#cityinfo").html(cityinfo);
			//setCity(cityinfo);
		}
		function setCity(obj){
			$.post('${ctxFront}/json/getSiteidByName', {
				name : obj
			}, function(data) {
				// 定位城市选中
				var $autocity = $('input[data-autocity="yes"]');
				$autocity.val(cityinfo);
				$autocity.next('input').val(data.siteid);
			});
		}
	}
</script>
	</head>
	<body>
		<%@include file="../index/head.jsp" %>
		    <div id="govaircraft">
		    	  <div class="gov-air-main">
		    	      <P style="color:red;font-size:14px;padding:10px 0">注： 从${tRentproduct.departcity.sitename }到${tRentproduct.aboardAddress }驾车预计需要${tRentproduct.maptime } 总路程大约为：${tRentproduct.mapkm }</P>
		    	  	  <div class="g-choice-top">
		    	  	  	 <div class="gair-choice-tit">
		    	  	  	 	 <span class="pick-air search-ps">接机</span>
		    	  	  	 	 <span class="send-air">送机</span>
		    	  	  	 </div>
		    	  	  	 <div class="gov-choice-box">
		    	  	  	 <form id="airportRentForm" action="${ctxGov }/airRentList" method="post">
						<input type="hidden" name="rentType" value="${ORDER_TYPE_RENTPRODUCT_AIRPLANE }"/>
						<input type="hidden" name="mapkm" value="${tRentproduct.mapkm }" id="mapkm"/>
						<input type="hidden" name="maptime" value="${tRentproduct.maptime }" id="maptime"/>
						<input type="hidden" name="mes" value="${tRentproduct.remarks }" id="mes"/>
						<input type="hidden" name="tstyle" value="${tstyle }" id="tsy"/>
						<input type="hidden" name="aboardAddress" value="${tRentproduct.aboardAddress }" id="aboardAddress"/>
						<input id="pageNo" name="pageNo" type="hidden" value="1"/>
							<input id="pageSize" name="pageSize" type="hidden" value="6"/>
						<input id="airportRentType" type="hidden" name="tabType" value="接机"/>
		    	  	  	 	 	  <div class="airchoice-il">
		    	  	  	 	 	  	  <span class="g-airport">出发机场：</span>
		    	  	  	  	     	 <input type="text" id="departcity_sitename3" class="display_ib flex_select1 date_3" name="departcity.sitename" 
										value="${tRentproduct.departcity.sitename }" placeholder="请选择机场" autocomplete="off">
										<input type="hidden" name="departcity.siteid" value="${tRentproduct.departcity.siteid }">
		    	  	  	 	 	  </div>
		    	  	  	 	 	  <div class="airchoice-il">
		    	  	  	 	 	  	  <span class="g-aircity">抵达地点：</span>
		    	  	  	  	     	 <input type="text" id="destcity_sitename3" 
								        class="display_ib flex_select1 addss" name="destcity.sitename"
								         value="${tRentproduct.destcity.sitename }" style="padding-left: 10px;width: 120px;" placeholder="请输入" autocomplete="off">
										<input type="hidden" name="destcity.siteid"  id="destcity.siteid" value="${tRentproduct.destcity.siteid }">
										
									<input type="text" placeholder="${tRentproduct.aboardAddress }" id="suggestId" name="aboardAddress" class="addss apt-date"  />
									<div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;"></div></div>
		    	  	  	 	 	  <div class="airchoice-il">
		    	  	  	 	 	  	  <span>出发时间：</span>
		    	  	  	  	     	  <input type="text" style="width: 260px;" placeholder="请选择出发时间" name="fromdateStr"  value="${tRentproduct.fromdateStr }" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false,maxDate:'${maxDay }',minDate:'%y-%M-%d'})"/>
		    	  	  	 	 	 </div>
		    	  	  	 	 	 <div class="airchoice-ii">
		    	  	  	 	 	 	  <input type="submit" value="查询" />
		    	  	  	 	 	 </div>
		    	  	  	 	 </form>
		    	  	  	 </div>
		    	  	  	<div class="gov-cars-choice">
						 <div class="gov-car-ctit">
							<p>选择车型：</p>
							<p>
								<a  class="tstyle" value=""  href="javascript:;">
								<span class="txt_gov">不限</span>
								</a>
							</p>
						</div>
						<div class="gov-car-il">
							<a  class="tstyle" value="xc"  href="javascript:;">
							<i class="iconfont <c:if test='${tstyle == "xc" }'>gov-c-green</c:if>">&#xe66c;</i>
							<span class="txt_gov">4座小车</span>
							</a>
						</div>
						<div class="gov-car-il">
							<a  class="tstyle" value="swc">
							<i class="iconfont <c:if test='${tstyle == "swc" }'>gov-c-green</c:if>">&#xe607;</i>
							<span class="txt_gov">6座商务车</span>
							</a>
						</div>
						<div class="gov-car-il">
							<a  class="tstyle" value="xb">
							<i class="iconfont <c:if test='${tstyle == "xb" }'>gov-c-green</c:if>">&#xe61b;</i>
							<span class="txt_gov">14座以下小巴</span>
							</a>
						</div>
						<div class="gov-car-il">
							<a  class="tstyle" value="zb">
							<i class="iconfont <c:if test='${tstyle == "zb" }'>gov-c-green</c:if>">&#xe665;</i>
							<span class="txt_gov">24座以下中巴</span>
							</a>
						</div>
						<div class="gov-car-il">
							<a  class="tstyle" value="db">
							<i class="iconfont <c:if test='${tstyle == "db" }'>gov-c-green</c:if>">&#xe65d;</i>
							<span class="txt_gov">25座以上中巴</span>
							</a>
						</div>
					</div>
				</div>
				
		    	  	  
		    	  	<div class="govday-tw-body">
					<div class="carday_vs">
						<div class="carf_list">
						
						 <c:forEach items="${rentproductList}" var="info">
							<div class="carf_oi">
								<div class="carg_i">
									<div class="carg_l_img">
										<img src="../${info.cargotype.images}" />
									</div>
									<div class="carg_r_ex">
										<div class="carg_nm">
											<p>
												<span>${info.cargotype.typename}</span>
												<span>
               	    	 	 	   	   	   	    <i class="cig-ico01"></i>
               	    	 	 	   	   	   	    <b>核载${info.cargotype.seats}人</b>
               	    	 	 	   	   	   </span>
												<span>
               	    	 	 	   	   	   	    <i class="cig-ico02"></i>
               	    	 	 	   	   	   	    <b>件数${info.cargotype.packs}件</b>
               	    	 	 	   	   	   </span>
											</p>
											<p>${info.cargotype.typedesc}</p>
										</div>
									</div>
									<div class="carg_kl">
										<p>￥${info.lowestAirPrice}起</p>
									</div>
								</div>
								<div class="caro_li">
									<div class="caro_ik_tit">
										<span>车队</span>
										<span>特色服务</span>
										<span>价格</span>
										<span>操作</span>
									</div>
									<div class="caro_body">
										<c:if test="${fn:length(info.officeList)>1}">
										<i class="caro_jia">
										</i>
										</c:if>
										 <c:forEach items="${info.officeList}" var="office" varStatus="vs">
										<div  class="caro_ik <c:if test='${vs.index==0}'>m_price</c:if>
										 		<c:if test='${vs.index!=0}'>hid_price</c:if> ">
											<span>${office.abbr} </span>
											<span>
											<c:if test="${office.businesssuit == '1'}">商务正装</c:if> &nbsp;
											<c:if test="${office.tablewater == '1'}">免费提供矿泉水</c:if> &nbsp;
											<c:if test="${office.paper == '1'}">纸巾</c:if> &nbsp;
											<c:if test="${office.iswifi == '1'}">无线wifi</c:if> &nbsp;
											<c:if test="${office.powersupply == '1'}">车载充电</c:if> &nbsp;
											</span>
											<span>${office.suitrtnprice}元</span>
											<span>
											<form action="${ctxGov}/airdetails" method="post">
											<input type="hidden" name="time" value="${tRentproduct.time }"/>
											<input type="hidden" name="departcity.sitename" value="${tRentproduct.departcity.sitename }"/>
											<input type="hidden" name="destcity.sitename" value="${tRentproduct.destcity.sitename }"/>
											<input type="hidden" name="productname" value="${tRentproduct.productname }"/>
											<input type="hidden" name="office.name" value="${office.name }"/>
											<input type="hidden" name="office.iswifi" value="${office.iswifi }"/>
											<input type="hidden" name="office.powersupply" value="${office.powersupply }"/>
											<input type="hidden" name="office.tablewater" value="${office.tablewater }"/>
											<input type="hidden" name="aboardAddress" value="${tRentproduct.aboardAddress }"/>
											<input type="hidden" name="cargotype.typedesc" value="${info.cargotype.typedesc }"/>
											<input type="hidden" name="cargotype.typename" value="${info.cargotype.typename }"/>
											<input type="hidden" name="office.businesssuit" value="${office.businesssuit }"/>
											<input type="hidden" name="office.paper" value="${office.paper }"/>
											<input type="hidden" name="office.abbr" value="${office.abbr }"/>
											<input type="hidden" name="cargotype.cargotypeid" value="${info.cargotype.cargotypeid }"/>
											<input type="hidden" name="cargotype.images" value="${info.cargotype.images }"/>
											<input type="hidden" name="tabType" value="${tRentproduct.tabType}"/>
											<input type="hidden" name="office.suitrtnprice" value="${office.suitrtnprice }"/>
											<input type="hidden" name="cargotype.outtimefee" value="${info.cargotype.outtimefee }"/>
											<input type="hidden" name="cargotype.outkmsfee" value="${info.cargotype.outkmsfee }"/>
											<input type="hidden" name="fromdateStr" value="${tRentproduct.fromdateStr }"/>
											<input class="btnyd" type="submit"  value="预定"/>
											</form>
               	    	 	 	 	 </span>
										</div>
										</c:forEach>
									</div>
								</div>
							</div>
							</c:forEach>
						</div>
					</div>
				</div>
				<c:if test="${empty page.list }">
				<div style="text-align: center;margin:20px;font-size:14px;color:#607D8B;">霞客君太懒，您要的产品还没有上架。您可以试试<a href="${ctxGov }/customRent" style="color:#4FBDBA;">定制包车</a>哦~</div>
				</c:if>
				</div>
				<div style="text-align: center;">
		<div class="pagination  font_normal_size" >${page.html}</div></div>
				</div>
		<%@include file="../index/foot.jsp" %>
	</body>
</html>
